Những câu hỏi liên quan
Hello1234
Xem chi tiết
Minh Hiếu
8 tháng 9 2021 lúc 6:40

#include <iostream>
using namespace std;
int main()
{
    int n,i,j;
    cout<<"Nhap n="; cin>>n;
    for (i=1; i<=n; i++)
    {
        for (j=i; j<=i+n-1; j++)
            cout<<j<<" ";
        cout<<endl;
    }
    return 0;
}

Bình luận (1)
Minh Hiếu
8 tháng 9 2021 lúc 6:41

#include <iostream>
using namespace std;
int main()
{
    int t,m,n,ucln;
    cout<<"Nhap n="; cin>>n;
    cout<<"Nhap m="; cin>>m;
    t=m%n;
    while (t!=0)
    {
        t=n%m;
        n=m;
        m=t;
    }
    ucln=n;
    cout<<ucln;
    return 0;
}

Bình luận (1)
Nguyễn Lê Phước Thịnh
8 tháng 9 2021 lúc 23:19

#include <iostream>
using namespace std;
int main()
{
    int n,i,j;
    cout<<"Nhap n="; cin>>n;
    for (i=1; i<=n; i++)
    {
        for (j=i; j<=i+n-1; j++)
            cout<<j<<" ";
        cout<<endl;
    }
    return 0;
}

Bình luận (0)
chickendanceneverdie
Xem chi tiết
Hello1234
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 9 2021 lúc 2:03

#include <iostream>
using namespace std;
int main()
{
    int t,m,n,ucln;
    cout<<"Nhap n="; cin>>n;
    cout<<"Nhap m="; cin>>m;
    t=m%n;
    while (t!=0)
    {
        t=n%m;
        n=m;
        m=t;
    }
    ucln=n;
    cout<<ucln;
    return 0;
}

 

Bình luận (0)
Hưng Quốc
Xem chi tiết
Thanh Phong (9A5)
31 tháng 3 2023 lúc 16:51

1. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do write(i:3);

readln;

end.

2. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(i mod 2 = 0) then write(i:3);

readln;

end.

Bình luận (0)
láobốlaos
31 tháng 3 2023 lúc 16:54

1. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do write(i:3);

readln;

end.

2. Uses crt;

var n,i: integer;

begin clrscr;

readln(n);

for i:=1 to n do if(i mod 2 = 0) then write(i:3);

readln;

end.

Bình luận (0)
Nguyễn Hoàng Duy
2 tháng 4 2023 lúc 16:31

1.

program InDaySoTuNhien;
var n, i: integer;
begin
   write('Nhap so nguyen duong n: ');
   readln(n);

   writeln('Day so tu 1 den ', n, ' la:');
   for i := 1 to n do
      write(i, ' ');
end.

2.

program InSoChan;
var
   n, i: integer;
begin
   write('Nhap so nguyen n: ');
   readln(n);

   writeln('Cac so nguyen chan trong khoang tu 1 den ', n, ' la:');
   for i := 1 to n do
   begin
      if i mod 2 = 0 then
         write(i, ' ');
   end;
end.

Bình luận (0)
89654DAUUBUOIIIII956
Xem chi tiết
Phía sau một cô gái
22 tháng 7 2023 lúc 20:06

program tong_so_le;

var

     n, i, a_i, tong: integer;

begin

     writeln('Nhap vao so nguyen khong am n:');

     readln(n);

     while (n <= 0) or (n > 100) do

     begin

          writeln('So nguyen n phai thoa man 0 < n <= 100, vui long nhap lai:');

          readln(n);

     end;

     writeln('Nhap vao ', n, ' so nguyen a1, a2, ..., an:','<mỗi số nguyên nhập trên một hàng>');

     tong := 0; // Khởi tạo tổng bằng 0

     for i := 1 to n do

     begin

          readln(a_i);

          if i mod 2 = 1 then

               tong := tong + a_i; 

     end;

     writeln('Tong cac so tai vi tri le trong mang la: ', tong);

end.

Bình luận (0)
luu tean khanh
Xem chi tiết
Phía sau một cô gái
27 tháng 2 2023 lúc 19:46

var A:

     array[1..n] of int64;

     i, n, count: integer;

begin

     write('Nhap so phan tu cua mang: ');

     readln(n);

     for i := 1 to n do

     begin

          write('Nhap phan tu thu ', i, ': ');

          readln(A[i]);

      end;

 

     count := 0;

     for i := 1 to n do

          if A[i] > 0 then

               count := count + 1;

     writeln('So luong cac so nguyen duong trong mang la: ', count); end.

Bình luận (0)
Nguyễn Phạm Như Quỳnh
Xem chi tiết
Ngoc Tu Nguyen Ba
Xem chi tiết
Nguyên Hưng Trần
23 tháng 7 2021 lúc 20:10

Uses crt;

var i,n,dem:integer;

Begin

clrscr;

write('Nhap n: ');readln(n);

dem:=0;

for i:= 1 to n do

  begin

  if i mod 2 = 1 then 

    begin

    write(i,'   ');

    inc(dem);

    end;

  if dem mod 15 = 0 then writeln;

  end;

Readln;

End.

Bình luận (0)
phạm quang huy
6 tháng 8 2021 lúc 20:16

uses crt;

var i,n,dem:longint;

BEGIN

clrscr;

write('nhap so nguyen duong n:');readln(n);

dem:=0;

for i:=1 to n do 

begin

if n mod 2 =1  do 

begin

inc(dem);

write(i,' ')

if dem=15 then writeln;

end;

end;

readln;

end.

Bình luận (0)
minh
Xem chi tiết